<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
	<head>
		<base href="<%=basePath%>"/>
		<meta charset="utf-8" />
		<title>Document</title>
		<link rel="stylesheet" href="css/Address.css?_<%=new Date().getTime() %>" />
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="js/Address.js?_<%=new Date().getTime() %>"></script>
		<script type="text/javascript">
			function xiu(id,obj) {
				//获取地址
				var sheng = $(obj).parents(".yi").find(":input[name = 'sheng']").val();
				var shi = $(obj).parents(".yi").find(":input[name = 'shi']").val();
				var xian = $(obj).parents(".yi").find(":input[name = 'xian']").val();
				 $.post("readAddress.shtml",{"id":id},function(date){
					var x=date.split(",");
					$("#mobile").val(x[0]);
					$("#phone").val(x[1]);
					$("#xiangXi1").val(x[2]);
					$("#xiangXi").val(x[3]);
					$("#bianid").val(x[4]);
					$(".bianjiid").val(id);
					
					$(".info1 #area select").eq(0).val(sheng).trigger("change");
					$(".info1 #area select").eq(1).val(shi).trigger("change");
					$(".info1 #area select").eq(2).val(xian);
					/* var a=$(".bianjiid").val();
					alert(a); */
				}) 
				
				
				 
				
			}
		</script>
	</head>
	<body>
		<div id="hezi">
			<p class="address">收货地址</p>
			<table cellspacing="0">
				<tr>
					<th>收货人</th>
					<th>详细地址</th>
					<th>电话/手机</th>
					<th>操作</th>
				</tr>
			</table>
			<c:forEach items="${shoppingAddresslist }" var="list">
				<div class="yi">
					<input type="hidden" name="sheng" id="sheng" value="${list.sa_sheng }"/>
					<input type="hidden" name="shi" id="shi" value="${list.sa_shi }"/>
					<input type="hidden" name="xian" id="xian" value="${list.sa_xian }"/>
					<span><input type="hidden" value="${list.sa_id }" id="bianjiid"  name="id"/></span>
					<span style="margin-left: 65px;">${list.sa_name }</span>
					<span style="margin-left: 40px;">${list.sa_sheng }-${list.sa_shi }-${list.sa_xian }-${list.sa_address },${list.sa_postcode }</span>
					<span style="margin-left: 85px;" class="phone">${list.sa_phone }</span>
					<span style="margin-left: 128px;" class="bianji"><span class="tanchu" onclick="xiu(${list.sa_id },this)">编辑</a></span>&ensp;&ensp;&ensp;<span class="del" onclick="del(this,${list.sa_id})">删除</span></span>
				</div>
			</c:forEach>
			<div class="add">增加地址</div>
			<div class="addAddress">
				<form action="addressaserlvet.shtml" method="post" id="addadd">
					<div><span>*</span>收 货 人: <input type="text" name="people" autocomplete="off" placeholder="请填写在真实姓名" /></div>
					<div class="area" id="area"><span>*</span>地&ensp;&ensp;&ensp;&ensp;区: </div>
					<div><span>*</span>详细地址: <input type="text" name="address" autocomplete="off" placeholder="请填写详细地址" /></div>
					<div>&ensp;邮政编码: <input type="text" name="bianma" autocomplete="off" placeholder="请填写邮政编号" /></div>
					<div><span>*</span>手&ensp;&ensp;&ensp;&ensp;机: <input type="text" name="phone" autocomplete="off" placeholder="请填写手机号" /></div>
					
					<div class="btn"><input type="submit" id="tijiao" value="增加这个地址" /></div>
				</form>
			</div>
		</div>
			<!-- 填写地址 -->
		<div class="bj"></div>
			 <div class="black"></div>
			 <div id="shou">
		        <h2><span>编辑收货地址</span></h2>
		        <div class="info1">
		            <form action="bianjiaddress.shtml" method="post" id="myform">
		            <p><input type="hidden" name="sheng" class="sheng"  value="" />
			            <input type="hidden" name="shi" class="shi"  value="" />
			            <input type="hidden" name="xian" class="xian"  value="" /></p>
			            <p><input type="hidden" class="bianjiid" value="" name="bianjiid" /></p>
		                <p>姓名<span>*</span><input type="text" id="mobile" name="name" style="font-size: 11px;" value="" placeholder="请输入姓名" maxlength="15" id="user"/><span id="divMobile"></span>
		                	手机号<span>*</span><input type="text" id="phone" name="phone" style="font-size: 11px;" value="" placeholder="请输入11位手机号" maxlength="11"/><span id="divMobile1"></span>
		                <div class="area" id="area">地址<span>*</span></div>
		                <p class="xxxx">详细信息<span>*</span><input type="text" id="xiangXi" name="xiangxi" value="" style="font-size: 11px;" placeholder="请输入详细地址，例如路名、门牌号"/></p>
		                <p class="yz">邮政编码<span>*</span><input type="text" id="xiangXi1" name="bianhao" value="" style="font-size: 11px;" placeholder="请输入你的邮政编码"/><span id="divMobile2"></span></p>
		                <p class="qr"><input type="submit" class="queding" value="确认修改" id="xiugai" /><input type="button" id="quxiao" value="取消"/></p>
		                
		            </form>
		        </div>
		    </div>
	</body>
</html>
